package com.lyc.day1107.demo02;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/7 21:28
 * @description：
 * @modified By：
 * @version:
 */
public class Singleton2 {
    private Singleton2(){}

    private static Singleton2 singleton=new Singleton2();

//    static Singleton2 getInstance(){
//        return singleton;
//    }

    public static Singleton2 getInstance(){
        if (singleton==null){
            synchronized (Singleton2.class){
                if (singleton==null){
                    singleton=new Singleton2();
                }
            }
        }
        return singleton;
    }
    private void show(){
        System.out.println("-------------show方法--------------");
    }
}